package com.example.teesystem.controller;

import cn.hutool.json.JSONUtil;
import com.example.teesystem.common.utils.*;
import com.example.teesystem.common.utils.FileUtils;
import com.example.teesystem.common.utils.Response;
import lombok.RequiredArgsConstructor;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequiredArgsConstructor
@RequestMapping("/tee/test")
public class TestController {
    private final HttpServletResponse response;

    @PostMapping("/testFileUp")
    public Response testFileUp(@RequestParam("file") MultipartFile[] files) {
        return FileUtils.UploadFile(files, "txt");
    }
    @RequestMapping("/test")
    public Response test(){
        String s = "HttpUtil";
        return Response.ok(s);
    }

    @RequestMapping("/test2")
    public Response test2() {
        response.setContentType("application/json;charset=utf-8");
        PdfFontUtil.createPdfPage(response);
        return Response.ok();
    }


}
